package com.atguigu.lease.handler;

import com.atguigu.lease.result.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@Slf4j
@RestControllerAdvice
public class GlobalExceptionHandler {

    @ExceptionHandler
    public Result exceptionHandler(Exception e) {
        log.error("全局异常处理：{}", e.getMessage());
        return Result.error().message(e.getMessage());
    }
}
